package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.entity.Device;
import com.zzyl.vo.DeviceDataVo;
import com.zzyl.vo.retreat.DeviceVo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DeviceMapper {
    @Select("select count(*) from device where device_name=#{deviceName}")
    int getCountByName(String deviceName);


    void insertDevice(Device device);

    Page<DeviceDataVo> page(@Param("deviceName")String deviceName, @Param("locationType")Integer locationType, @Param("productKey")String productKey);

    @Select("select * from device where iot_id=#{iotId}")
    DeviceVo getByIotId(String iotId);

    @Select("select * from device where device_name=#{deviceName}")
    DeviceVo getByDeviceName(String deviceName);


    void updateDeviceById(Device device);

    @Delete("delete from device where iot_id=#{iotId}")
    void deleteByIotId(String iotId);

    List<Long> getNursingByElder(String iotId);

    List<Long> getNursingByBed(String iotId);
}
